package StudyCode.summary.mycollection;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CreateSynchronizedMap {
	public static void main(String[] argv) {
		System.out.println(synchronizedMap());
	}

	public static <K, V> Map<K, V> synchronizedMap() {
		return Collections.synchronizedMap(new HashMap<K, V>());
	}

	public static <K, V> Map<K, V> synchronizedMap(final int initialCapacity) {
		return Collections.synchronizedMap(new HashMap<K, V>(
				initialCapacity));
	}

	protected static <K, V> Map<K, V> synchronizedMap(
			final int initialCapacity, final float loadFactor) {
		return Collections.synchronizedMap(new HashMap<K, V>(
				initialCapacity, loadFactor));
	}
}
